<template>
    <view class="roomList">
        <view class="roomList-item" v-for="(item, index) in roomList" :key="index">
            <view class="roomList-item-info" @click="toRoomDetail(item.id)">
                <!--                <view class="image">-->
                <!--                    <u-image :src="item.room_banner_images" width="150" height="150"/>-->
                <!--                </view>-->
                <view class="roomList-item-info-text">
                    <view class="name">
                        <uni-icons type="pyq" size="26" color="#ffffff"></uni-icons>
                        <h3>{{ item.room_name }}</h3>
                    </view>
                    <view class="time">

                        <view class="time-item">
                            Activity time ：
                            {{ formatTime(item.start_time) }}
                            ~
                            {{ formatTime(item.end_time) }}
                        </view>
                        <view class="time-item" style="color: #fada62">
                            Ends ：
                            {{ formatTime(item.prize_time) }}
                        </view>
                    </view>

                </view>

            </view>
            <view class="introduce">
                <view>
                    <u-icon name="gift-fill" size="16px" style="padding-right: 10rpx"></u-icon>
                    number ： {{ item.goods_num }}
                </view>
                <view>
                    <uni-icons type="person-filled" size="16" color="#ffffff" style="padding-right: 10rpx"></uni-icons>
                    {{ item.join_num }}/{{ item.num }}
                </view>
                <view>
                    Total ：
                    <i class="custom-icon custom-icon-objects-color_diamond"
                       style="padding-right: 10rpx;color: #65a5c7"></i>
                    {{ item.goods_coin_amount }}
                </view>
            </view>
            <view class="goods-images">
                <view v-for="(image, index) in item.goods_images" :key="index">
                    <u-image :src="image" width="100" height="100"></u-image>
                </view>
            </view>
        </view>
    </view>
</template>
<script>
export default {
    name: 'roomList',
    props: {
        roomList: {
            type: Array,
            default: () => [],
            required: true
        }
    },
    data() {
        return {}
    },
    mounted() {
    },
    methods: {
        formatTime(timeStamp) {
            return new Date(timeStamp * 1000).toLocaleString()
        },
        toRoomDetail(id){
            this.$u.route({
                type: 'navigateTo',
                url: '/pages/exercise/roomDetail/roomDetail?id=' + id
            })
        }
    }
}

</script>
<style scoped lang="scss">
.roomList {
    padding: 20rpx;
    //background-color: #060a1e;
    color: #ffffff;


    .roomList-item {
        //background: linear-gradient(to bottom, #1d1b49, #0f0e2d);
        background-color: #242c54;
        border-radius: 20rpx;
        //height: 400rpx;
        margin-bottom: 20rpx;

        .roomList-item-info {
            display: flex;
            flex-direction: column;

            .image {
                margin: 15rpx;
            }

            .roomList-item-info-text {
                display: flex;
                flex-direction: column;

                .name {
                    padding-top: 15rpx;
                    padding-left: 20rpx;
                    display: flex;
                    flex-direction: row;
                }

                .time {
                    padding: 20rpx;
                    display: flex;
                    flex-direction: column;

                    .time-item {
                        text-align: center;
                        line-height: 24rpx;
                        font-size: 20rpx;
                    }
                }
            }
        }

        .introduce {
            padding: 20rpx;
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            line-height: 24rpx;
            font-size: 24rpx;

        }

        .goods-images {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            padding: 20rpx;
        }
    }
}


</style>